package com.wl.auth.controller;

import com.wl.auth.service.AuthService;
import com.wl.common.core.constant.ConstantSystem;
import com.wl.common.core.web.dto.RestResultDTO;
import com.wl.common.system.support.dto.ResetPasswordDTO;
import io.swagger.v3.oas.annotations.Operation;
import io.swagger.v3.oas.annotations.tags.Tag;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.validation.annotation.Validated;
import org.springframework.web.bind.annotation.*;

/**
 * @author: wanglin
 * @date: 2024-03-11 周一
 * @Version: 1.0
 * @Description:
 */
@Tag(name = "系统用户等接口", description = "AuthController")
@Validated
@CrossOrigin
@RestController
@RequestMapping(ConstantSystem.PROJECT_SYS_URL_PREFIX + "auth")
public class AuthController {
    @Autowired
    private AuthService authService;

    //    @PreAuthorize("hasAnyAuthority('ADMIN')")
//    @Operation(summary = "重置密码——管理员")
//    @RequestMapping(value = "resetPassword", method = {RequestMethod.PUT, RequestMethod.POST})
//    public RestResultDTO<Void> resetPassword(@Parameter(description = "用户Id") String userId, @Parameter(description = "重置密码") String password) {
//        authService.resetPassword(userId, password);
//        return RestResultDTO.newSuccess();
//    }

    @Operation(summary = "重置密码——管理员")
    @RequestMapping(value = "resetUserPwd", method = {RequestMethod.PUT, RequestMethod.POST})
    public RestResultDTO<Void> resetUserPwd(@Validated @RequestBody ResetPasswordDTO dto) {
        authService.resetUserPwd(dto);
        return RestResultDTO.newSuccess();
    }

}
